package com.qst.mapreduce.wordcount.taobao;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

public class Info2Mapper extends Mapper<LongWritable, Text,App, Text> {

    @Override
    protected void map(LongWritable key, Text value, Mapper<LongWritable, Text, App, Text>.Context context) throws IOException, InterruptedException {
        String line=value.toString();
        String[] words=line.split("\t");
        App app=new App();
        app.setBrowseCount(Integer.parseInt(words[1]));
        app.setCTR(Double.parseDouble(words[2]));
        context.write(app,new Text(words[0]));

    }
}
